/*
 * Galaxium Messenger
 * 
 * Copyright (C) 2009 Philippe Durand <draekz@gmail.com>
 * 
 * License: GNU General Public License (GPL)
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 2 of the License, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

using System;
using System.Collections.Generic;

namespace Galaxium.Protocol.Facebook
{
	public class FacebookData
	{
		private int _error = 0;
		private string _errorSummary = String.Empty;
		private string _errorDescription = String.Empty;
		private bool _errorIsWarning = false;
		private BuddyListPayload _payload = null;
		private BootData[] _bootload = null;
		private string[] _onload = null;
		
		public int error { get { return _error; } set { _error = value; } }
		public string errorSummary { get { return _errorSummary; } set { _errorSummary = value; } }
		public string errorDescription { get { return _errorDescription; } set { _errorDescription = value; } }
		public bool errorIsWarning { get { return _errorIsWarning; } set { _errorIsWarning = value; } }
		public BuddyListPayload payload { get { return _payload; } set { _payload = value; } }
		public BootData[] bootload { get { return _bootload; } set { _bootload = value; } }
		public string[] onload { get { return _onload; } set { _onload = value; } }
		
		public FacebookData()
		{
			_payload = new BuddyListPayload ();
			_bootload = new BootData[0];
			_onload = new string[0];
		}
	}
	
	public class BuddyListPayload
	{
		private long _time = 0;
		private BuddyListData _buddyList = null;
		private NotificationData _notifications = null;
		
		public long time { get { return _time; } set { _time = value; } }
		public BuddyListData buddy_list { get { return _buddyList; } set { _buddyList = value; } }
		public NotificationData notifications { get { return _notifications; } set { _notifications = value; } }
		
		public BuddyListPayload ()
		{
			_buddyList = new BuddyListData ();
			_notifications = new NotificationData ();
		}
	}
	
	public class BuddyListData
	{
		private bool _listChanged = false;
		private int _availableCount = 0;
		private Dictionary<string, AvailabilityData> _nowAvailableList = null;
		private int[] _wasAvailableIDs = null;
		private Dictionary<string, UserInfoData> _userInfos = null;
		private bool _forcedRender = false;
		private int _flLive = 0;
		private bool _flMode = false;
		private FLData _flData = null;
		
		public bool listChanged { get { return _listChanged; } set { _listChanged = value; } }
		public int availableCount { get { return _availableCount; } set { _availableCount = value; } }
		public Dictionary<string, AvailabilityData> nowAvailableList { get { return _nowAvailableList; } set { _nowAvailableList = value; } }
		public int[] wasAvailableIDs { get { return _wasAvailableIDs; } set { _wasAvailableIDs = value; } }
		public Dictionary<string, UserInfoData> userInfos { get { return _userInfos; } set { _userInfos = value; } }
		public bool forcedRender { get { return _forcedRender; } set { _forcedRender = value; } }
		public int flLive { get { return _flLive; } set { _flLive = value; } }
		public bool flMode { get { return _flMode; } set { _flMode = value; } }
		public FLData flData { get { return _flData; } set { _flData = value; } }
		
		public BuddyListData ()
		{
			_nowAvailableList = new Dictionary<string, AvailabilityData> ();
			_nowAvailableList.Add ("123454", new AvailabilityData());
			
			_wasAvailableIDs = new int[0];
			
			_userInfos = new Dictionary<string, UserInfoData> ();
			_userInfos.Add ("12345", new UserInfoData ());
			
			_flData = new FLData ();
		}
	}
	
	public class AvailabilityData
	{
		private bool _i = false;
		
		public bool i { get { return _i; } set { _i = value; } }
		
		public AvailabilityData ()
		{
			
		}
	}
	
	public class UserInfoData
	{
		private string _name = String.Empty;
		private string _firstName = String.Empty;
		private string _thumbSrc = String.Empty;
		private string _status = String.Empty;
		private long _statusTime = 0;
		private string _statusTimeRel = String.Empty;
		
		public string name { get { return _name; } set { _name = value; } }
		public string firstName { get { return _firstName; } set { _firstName = value; } }
		public string thumbSrc { get { return _thumbSrc; } set { _thumbSrc = value; } }
		public string status { get { return _status; } set { _status = value; } }
		public long statusTime { get { return _statusTime; } set { _statusTime = value; } }
		public string statusTimeRel { get { return _statusTimeRel; } set { _statusTimeRel = value; } }
		
		public UserInfoData ()
		{
			
		}
	}
	
	public class FLData
	{
		public FLData ()
		{
			
		}
	}
	
	public class NotificationData
	{
		private int _countNew = 0;
		private int _count = 0;
		private Dictionary<string, string> _app_names = null;
		private int _latest_notif = 0;
		private int _latest_read_notif = 0;
		private string _markup = String.Empty;
		private int _inboxCount = 0;
		private string _inboxDropdownMarkup = String.Empty;
		
		public int countNew { get { return _countNew; } set { _countNew = value; } }
		public int count { get { return _count; } set { _count = value; } }
		public Dictionary<string, string> app_names { get { return _app_names; } set { _app_names = value; } }
		public int latest_notif { get { return _latest_notif; } set { _latest_notif = value; } }
		public int latest_read_notif { get { return _latest_read_notif; } set { _latest_read_notif = value; } }
		public string markup { get { return _markup; } set { _markup = value; } }
		public int inboxCount { get { return _inboxCount; } set { _inboxCount = value; } }
		public string inboxDropdownMarkup { get { return _inboxDropdownMarkup; } set { _inboxDropdownMarkup = value; } }
		
		public NotificationData ()
		{
			_app_names = new Dictionary<string, string>();
		}
	}
	
	public class BootData
	{
		private string _name = String.Empty;
		private string _type = String.Empty;
		private string _src = String.Empty;
		private bool _permanent = false;
		
		public string name { get { return _name; } set { _name = value; } }
		public string type { get { return _type; } set { _type = value; } }
		public string src { get { return _src; } set { _src = value; } }
		public bool permanent { get { return _permanent; } set { _permanent = value; } }
		
		public BootData ()
		{
			
		}
	}
}
